class RankItem extends egret.Sprite{
    
    
    constructor(index:number){
        super();

        let icon = null;

        if(index <= 3){
            icon = utils.createBitmapByName(index+'');
        }else{
            icon = utils.createTextField({
                width:50,
                height:30,
                size:27,
                textColor:0xF3F010,
                text:index+''
            });
        }
        this.addChild(icon);

        let rank_text:egret.TextField = utils.createTextField({
            text:'第'+this.getChinese(index)+'名',
            height:icon.height,
            x:icon.width+10,
            textColor:0xFFC71F,
            stroke:2,
            strokeColor:0x541C09,
            size:22
        });
        this.addChild(rank_text);

    }



    private getChinese(index:number){
        switch(index){
            case 1:
                return '一';
            case 2:
                return '二';
            case 3:
                return '三';
            case 4:
                return '四';
            case 5:
                return '五';
            case 6:
                return '六';
            case 7:
                return '七';
            case 8:
                return '八';
            case 9:
                return '九';
            case 10:
                return '十'
            default:
                return '';
            
        }
    }
}